<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateBalanceLog extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('balance_log', function (Blueprint $table) {
            $table->id();
            $table->integer('user_id')->default(0)->comment('用户ID');
            $table->integer('type')->default(0)->comment('');
            $table->float('value_before', 10, 2)->default(0)->comment('变动前');
            $table->float('value', 10, 2)->default(0)->comment('变动值');
            $table->string('description', 200)->nullable()->comment('说明');
            $table->integer('trade_id')->default(0)->comment('关联业务ID');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('balance_log');
    }
}
